package com.wuxinwudai.android.beans;

import android.os.Parcel;
import android.os.Parcelable;

import com.wuxinwudai.android.database.EntityBase;

/**
 * District 类存放区县信息
 * @author 吾心无待 于 2016年02月16日
 */
public class District extends EntityBase implements Parcelable {
    private String name;//区县名称
    private String zipCode;//邮政编码
    private String cityID;//所属城市 ID
    private City city;//所属城市
    private float longitude;//区县经度
    private float latitude;//区县纬度

    /**
     * 获取区县名称
     * @return 返回区县名称
     */
    public String getName() {
        return name;
    }

    /**
     * 设置区县名称
     * @param name 区县名称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取区县邮编
     * @return 返回区县邮编
     */
    public String getZipCode() {
        return zipCode;
    }

    /**
     * 设置区县邮编
     * @param zipCode 区县邮编
     */
    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    /**
     * 获取所属城市 ID
     * @return 返回城市 ID
     */
    public String getCityID() {
        return cityID;
    }

    /**
     * 设置所属城市ID
     * @param cityID 城市ID
     */
    public void setCityID(String cityID) {
        this.cityID = cityID;
    }

    /**
     * 获取所属城市
     * @return 返回所属城市
     */
    public City getCity() {
        return city;
    }

    /**
     * 设置所属城市
     * @param city 所属城市
     */
    public void setCity(City city) {
        this.city = city;
    }

    /**
     * 获取区县经度
     * @return 区县经度
     */
    public float getLongitude() {
        return longitude;
    }

    /**
     * 设置区县经度
     * @param longitude 区县经度
     */
    public void setLongitude(float longitude) {
        this.longitude = longitude;
    }

    /**
     * 获取区县纬度
     * @return 区县纬度
     */
    public float getLatitude() {
        return latitude;
    }

    /**
     * 设置区县纬度
     * @param latitude 区县纬度
     */
    public void setLatitude(float latitude) {
        this.latitude = latitude;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeString(this.zipCode);
        dest.writeString(this.cityID);
        dest.writeParcelable(this.city, flags);
        dest.writeFloat(this.longitude);
        dest.writeFloat(this.latitude);
        dest.writeInt(this.id);
    }

    public District() {
    }

    protected District(Parcel in) {
        this.name = in.readString();
        this.zipCode = in.readString();
        this.cityID = in.readString();
        this.city = in.readParcelable(City.class.getClassLoader());
        this.longitude = in.readFloat();
        this.latitude = in.readFloat();
        this.id = in.readInt();
    }

    public static final Parcelable.Creator<District> CREATOR = new Parcelable.Creator<District>() {
        @Override
        public District createFromParcel(Parcel source) {
            return new District(source);
        }

        @Override
        public District[] newArray(int size) {
            return new District[size];
        }
    };
}
